package main

import (
	"fmt"
	"reflect"
	"strconv"
)

func main()  {

	var x1, x2 int
	x1 = 5
	x2 = 9
	var b float64
	b = _NumberFormat(x1, x2)
	fmt.Println(b)
	a := Decimal(13.00500012, 8)
	fmt.Println(a, reflect.TypeOf(a))
}

func Decimal(value float64, t int) (result float64) {

	format := "%."+strconv.Itoa(t)+"f"
	result, _ = strconv.ParseFloat(fmt.Sprintf(format, value), 64)
	return
}

func _NumberFormat(a int, b int) (result float64) {

	aStr, err := strconv.ParseFloat(strconv.Itoa(a), 64)
	if err != nil {
		aStr = 0
	}
	bStr, err := strconv.ParseFloat(strconv.Itoa(b), 64)
	if err != nil {
		bStr = 0
	}

	return Decimal(aStr / bStr, 2)
}
